//
//  PolicyConsultContentView.m
//  Project two framework
//
//  Created by rimi on 16/7/26.
//  Copyright © 2016年 张峥. All rights reserved.
//

#import "PolicyConsultContentView.h"


@interface PolicyConsultContentView ()

@property(nonatomic,strong)UIView *contentView;
/**标题*/
@property(nonatomic,strong)UILabel *titLabel;
/**内容*/
@property(nonatomic,strong)UILabel *conentLabel;

@end

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

static  PolicyConsultContentView *policyConsultContentView = nil;
@implementation PolicyConsultContentView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _contentView = [[UIView alloc]initWithFrame:CGRectMake(120, 190, 870, 570)];
        _contentView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_contentView];
        
        _titLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.bounds.size.width - 100, 40, 200, 60)];
        _titLabel.backgroundColor = [UIColor orangeColor];
        _titLabel.font = [UIFont boldSystemFontOfSize:24];
        _titLabel.textAlignment = NSTextAlignmentCenter;
        [_contentView addSubview:_titLabel];
        
        _conentLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 40, 770, 30)];
        _conentLabel.backgroundColor = [UIColor orangeColor];
        _conentLabel.font = [UIFont systemFontOfSize:16];
        _conentLabel.textAlignment = NSTextAlignmentCenter;
        [_contentView addSubview:_conentLabel];
        
    }\

    return self;
}

+ (PolicyConsultContentView *)showAnimation{
    if ( policyConsultContentView == nil) {
        policyConsultContentView = [[PolicyConsultContentView alloc]initWithFrame:CGRectMake(-125 , -200, SCREEN_WIDTH, SCREEN_HEIGHT)];
        policyConsultContentView.backgroundColor = [UIColor blackColor];
//        policyConsultContentView.alpha = 0.4;
//        policyConsultContentView.center = CGPointMake(200, 300);
        //初始化手势
//        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGesture:)];
        
//        [policyConsultContentView addGestureRecognizer:tapGesture];
    }
    return policyConsultContentView;
}

//放大手势
//点击手势的监听方法
-(void)tapGesture:(UITapGestureRecognizer *)gesture//手势
{
    //点击了手势的事件触发是在事件结束的状态下回调的
    if (gesture.state == UIGestureRecognizerStateBegan) {
        
    }
    //2.这是在点击后发生的事情
    //点击过程中改变视图的属性
    //首先要获得当前图片视图中心
    else if (gesture.state == UIGestureRecognizerStateChanged){
        [UIView animateWithDuration:0.6 animations:^{
            policyConsultContentView.center = CGPointMake(200, 300);
        } completion:^(BOOL finished) {
            NSLog(@"------------过程中");
            //放大
            [UIView animateWithDuration:0.5 animations:^{
                
                policyConsultContentView.transform = CGAffineTransformMakeScale(2.0, 2.0);
            } completion:^(BOOL finished) {
                NSLog(@"-----------放大");
            }];
            
            
        }];
    }
    
    

}





@end
